<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //判断一个整数，属于哪个范围：大于0；小于0；等于0
      //   var a = parseInt(prompt("输入一个数"));
      //   if (a > 0) {
      //     document.write("大于0");
      //   } else if (a < 0) {
      //     document.write("小于0");
      //   } else if (a == 0) {
      //     document.write("等于0");
      //   }

      //判断一个整数是偶数还是奇数，并输出判断结果

      //   var a = parseInt(prompt("输入一个值"));
      //   if (a % 2 == 0) {
      //     document.write("偶数");
      //   } else if (a % 2 != 0) {
      //     document.write("奇数");
      //   }

      //输入年份判断改年是平年还是闰年 能够被4整除 且不能被100整除 或者 能够被400整除的年份就是闰年 其他的就是平年
      //   var a = parseInt(prompt("输入一个值"));

      //   if ((a % 4 == 0 && a % 100 != 0) || a % 400 == 0) {
      //     document.write("闰年");
      //   } else {
      //     document.write("平年");
      //   }
      //
    </script>
    <!-- // 开发一款软件，根据公式（身高-108）*2=体重，可以有10斤左右的浮动。来观察测试者体重是否为标准体重
    // 输入身高 还有体重 判断 体重是否是标准体重 ；
    // <input type="text" id="num1" />
    // <input type="text" id="num2" />
    // <button id="btn">提交</button> -->

    //
    <script>
      //   var btnEle = document.getElementById("btn");
      //   var num1Ele = document.getElementById("num1");
      //   var num2Ele = document.getElementById("num2");

      //   btnEle.onclick = function () {
      //     var num1 = num1Ele.value;
      //     var num2 = num2Ele.value;

      //     if ((num1 - 108) * 2 >= num2 - 10 && (num1 - 108) * 2 <= num2 + 10) {
      //       document.write("体重标准");
      //     } else {
      //       document.write("体重不标准");
      //     }
      //   };
      //
    </script>

    <!-- 案例：输入分数，判定成绩等级 -->
    <!-- <script>
      var a = parseInt(prompt("输入分数"));
      if (a <= 60) {
        document.write("不及格");
      } else if (a > 60 && a < 70) {
        document.write("及格");
      } else if (a >= 70 && a < 80) {
        document.write("良好");
      } else if (a >= 80 && a <= 100) {
        document.write("优秀");
      }
    </script>
     -->

    <!-- 计算两个文本框的加减乘除 -->
    <!-- <input type="text" id="input1" />
    <select name="" id="calc">
      <option value="+">+</option>
      <option value="-">-</option>
      <option value="*">*</option>
      <option value="/">/</option>
    </select>
    <input type="text" id="input2" />
    <button id="btn">提交</button>
    <input type="text" id="res" />

    <script>
      var num1 = document.getElementById("input1");
      var num2 = document.getElementById("input2");
      var res1 = document.getElementById("res");
      var btn1 = document.getElementById("btn");
      var calc1 = document.getElementById("calc");

      btn.onclick = function () {
        var input1 = parseInt(num1.value);
        var input2 = parseInt(num2.value);
        var calc = calc1.value;
        if (calc == "+") {
          var res = input1 + input2;
        } else if (calc == "-") {
          var res = input1 - input2;
        } else if (calc == "*") {
          var res = input1 * input2;
        } else if (calc == "/") {
          var res = input1 / input2;
        }
        res1.value = res;
      };
      console.log(res);
    </script> -->

    <!-- 输入三个数 判断是这一年的哪一天 -->

    输入年份<input type="text" id="year" /> 输入月份<input
      type="text"
      id="month"
    />
    输入日期<input type="text" id="day" />
    <button id="btn">提交</button>
    <script>
      var year1 = document.getElementById("year");
      var month1 = document.getElementById("month");
      var day1 = document.getElementById("day");
      var btn1 = document.getElementById("btn");
      btn1.onclick = function () {
        var year = parseInt(year1.value);
        var month = parseInt(month1.value);
        var day = parseInt(day1.value);

        var fab;
        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
          fab = 29;
        } else {
          fab = 28;
        }
        switch (month) {
          case 1:
            alert(day);
            break;
          case 2:
            var totalday = 31 + day;
            alert(totalday);
            break;
          case 3:
            var totalday = 31 + feb + day;
            alert(totalday);
            break;
          case 4:
            var totalday = 31 + feb + 31 + day;
            alert(totalday);
            break;
          case 5:
            var totalday = 31 + feb + 31 + 30 + day;
            alert(totalday);
            break;
          case 6:
            var totalday = 31 + feb + 31 + 30 + 31 + day;
            alert(totalday);
            break;
        }
      };
    </script>
  </body>
</html>
